package com.hotelvip.dao;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Lzh
 * @date 2020/12/1 10:39
 */
public interface SysRoleMenuMapper {

    @Select("select menu_id from sys_role_menus where role_id=#{roleId}")
    List<Integer> findMenuIdsByRoleId(Integer roleId);

    /**基于多个角色id获取对应的菜单id*/
    List<Integer> findMenuIdsByRoleIds(List<Integer> roleIds);

    /**
     * 保存角色菜单关系数据
     * @param roleId
     * @param menuIds
     * @return
     */
    int insertObjects(Integer roleId,Integer[]menuIds);
    /**
     *	基于菜单id删除角色菜单关系表数据
     * @param id
     * @return
     */
    //@Delete("delete from sys_role_menus where role_id=#{id}")
    //int deleteObjectByRoleId(Integer id);
    /**
     *	基于菜单id删除角色菜单关系表数据
     * @param id
     * @return
     */
    //@Delete("delete from sys_role_menus where menu_id=#{id}")
    //int deleteObjectByMenuId(Integer id);


    @Delete("delete from sys_role_menus where ${column}=#{id}")
    int deleteObjects(String column,Integer id);

}
